package com.huawei.statistics.common.service.kdbird;


import com.huawei.statistics.utils.Base64Utils;
import com.huawei.statistics.utils.MD5Utils;

import java.io.UnsupportedEncodingException;

/**
 * Created by XuZhansi on 2017/10/10.
 */
public class KDBird {

    private Integer eBusinessID;//商户id
    private String appKey;//appKey

    public Integer geteBusinessID() {
        return eBusinessID;
    }

    public void seteBusinessID(Integer eBusinessID) {
        this.eBusinessID = eBusinessID;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    /**
     * 加密获取dataSign
     *
     * @param content
     * @param charset
     * @return
     */
    public String encrytToSign(String content, String charset) {
        String md5= MD5Utils.getMD5Code(content+appKey,charset);
        try {
            return Base64Utils.base64Encode(md5.getBytes(charset));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
}
